#pragma once
#include "netdefine.h"


#ifdef _MSC_VER
#include <windows.h>
#else
#include <unistd.h>
#endif

struct IpPort
{
public:
	IpPort(sockaddr_in& addr) {
		m_ip = inet_ntoa(addr.sin_addr);
		m_port = ntohs(addr.sin_port);
	}
	IpPort(const IpPort& value):m_ip(value.m_ip),m_port(value.m_port) {

	}
	virtual~IpPort() {

	}

	int getPort() {
		return m_port;
	}

	std::string& GetIp() {
		return m_ip;
	}

	std::string ToString() {
		return "ip=" + m_ip + ","
			+ "port=" + std::to_string(m_port) + ",";
	}

private:
	std::string m_ip;
	int m_port;
};


